# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.930.33.2 -> 1.930.33.3 # drivers/acpi/include/acpixf.h 1.6.1.2 -> 1.6.1.3 # drivers/acpi/resources/rsxface.c 1.5.1.2 -> 1.5.1.3 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/02/14 bjorn_helgaas@hp.com 1.930.33.3 # ACPI: Add acpi_resource_to_address64(). # -------------------------------------------- # diff -Nru a/drivers/acpi/include/acpixf.h b/drivers/acpi/include/acpixf.h --- a/drivers/acpi/include/acpixf.h Wed Oct 8 09:06:52 2003 +++ b/drivers/acpi/include/acpixf.h Wed Oct 8 09:06:52 2003 @@ -340,6 +340,11 @@ acpi_handle bus_device_handle, acpi_buffer *ret_buffer); +acpi_status +acpi_resource_to_address64 ( + acpi_resource *resource, + acpi_resource_address64 *out); + /* * Hardware (ACPI device) interfaces diff -Nru a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c --- a/drivers/acpi/resources/rsxface.c Wed Oct 8 09:06:52 2003 +++ b/drivers/acpi/resources/rsxface.c Wed Oct 8 09:06:52 2003 @@ -317,3 +317,65 @@ status = acpi_rs_set_srs_method_data (device_handle, in_buffer); return_ACPI_STATUS (status); } + + +#define copy_field(out, in, field) out->field = in->field +#define copy_address(out, in) \ + copy_field(out, in, resource_type); \ + copy_field(out, in, producer_consumer); \ + copy_field(out, in, decode); \ + copy_field(out, in, min_address_fixed); \ + copy_field(out, in, max_address_fixed); \ + copy_field(out, in, attribute); \ + copy_field(out, in, granularity); \ + copy_field(out, in, min_address_range); \ + copy_field(out, in, max_address_range); \ + copy_field(out, in, address_translation_offset); \ + copy_field(out, in, address_length); \ + copy_field(out, in, resource_source); + +/******************************************************************************* + * + * FUNCTION: acpi_resource_to_address64 + * + * PARAMETERS: resource - Pointer to a resource + * out - Pointer to the users's return + * buffer (a struct + * acpi_resource_address64) + * + * RETURN: Status + * + * DESCRIPTION: If the resource is an address16, address32, or address64, + * copy it to the address64 return buffer. This saves the + * caller from having to duplicate code for different-sized + * addresses. + * + ******************************************************************************/ + +acpi_status +acpi_resource_to_address64 ( + acpi_resource *resource, + acpi_resource_address64 *out) +{ + acpi_resource_address16 *address16; + acpi_resource_address32 *address32; + acpi_resource_address64 *address64; + + switch (resource->id) { + case ACPI_RSTYPE_ADDRESS16: + address16 = (acpi_resource_address16 *) &resource->data; + copy_address(out, address16); + break; + case ACPI_RSTYPE_ADDRESS32: + address32 = (acpi_resource_address32 *) &resource->data; + copy_address(out, address32); + break; + case ACPI_RSTYPE_ADDRESS64: + address64 = (acpi_resource_address64 *) &resource->data; + copy_address(out, address64); + break; + default: + return (AE_BAD_PARAMETER); + } + return (AE_OK); +}